package com.lijing.mock.model.dto;

import com.lijing.mock.constract.MongoTableConstant;
import com.lijing.mock.constract.ValidateGroup;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.checkerframework.checker.regex.qual.Regex;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * url基本信息
 * @author by lijing
 * @date 2019/12/5 0005 11:22
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@Document(collection = MongoTableConstant.BASE_URL_CONFIG)
public class UrlBaseDTO implements Serializable {

    @Id
    @NotNull(message = "id不能为空",groups = {ValidateGroup.Update.class,ValidateGroup.Delete.class})
    private String id;
    /** url 地址 */
    @NotNull(message = "URL不能为空",groups = {ValidateGroup.Update.class,ValidateGroup.Add.class})
    private String url;
    /** 项目名称 */
    @NotNull(message = "项目名称不能为空",groups = {ValidateGroup.Update.class,ValidateGroup.Add.class})
    private String projectName;
    /** 请求方式 */
    @NotNull(groups = {ValidateGroup.Update.class,ValidateGroup.Add.class})
    @Pattern(regexp = "(post|POST|get|GET|Get|Post)",message = "不支持的请求方式")
    private String questMethod;

}
